﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Harkon.AppServer.cOne.Service;
using Harkon.AppServer.cOne.Registry;
using NUnit.ConsoleRunner;
using System.Reflection;

namespace Harkon.AppServer.cOne.IntegrationTest
{
    public abstract class IntegrationTestService : AbstractService
    {
        private static IntegrationTestService instance = null;

        public IntegrationTestService()
        {
            if (instance == null)
                instance = this;
        }

        public static IRegistry Registry
        {
            get
            {
                return instance.ServiceRegistry;
            }
        }

        protected abstract string GetExecutingAssembly();

        public override bool Start()
        {
            if (base.Start())
            {
                Runner.Main(new string[] { "/domain:None", GetExecutingAssembly() });
                return true;
            }
            return false;
        }
    }

    public abstract class AbstractIntegrationTest
    {
        protected IRegistry Registry
        {
            get
            {
                return IntegrationTestService.Registry;
            }
        }
    }
}
